class Blood extends AcGameObject {
    constructor(playground, color, player) {
        super();
        this.playground = playground;
        this.player = player;
        this.ctx = this.playground.game_map.ctx2;
        this.y = this.ctx.canvas.height / 4;
        this.x = this.y;
        this.width = this.ctx.canvas.width * 1 / 4;
        this.height = this.ctx.canvas.height / 2;
        this.color = color;
        this.eps = 0.1;
        this.spent_time = 0;
    }

    start() {
        this.ctx.fillStyle = "grey";
        this.ctx.fillRect(this.x, this.y, this.width, this.height);
    }

    update() {

        this.spent_time += this.timedelta / 1000;
        this.render();
    }

    render() {
        let angle = Math.PI * 2, color_ball = this.color;
        if (this.player.spent_time - this.player.last_absolute_defense_time < this.player.absolute_defense_cd) {
            angle = (this.player.spent_time - this.player.last_absolute_defense_time) / this.player.absolute_defense_cd * angle;
            color_ball = 'grey';
        }

        this.ctx.fillStyle = "grey";
        this.ctx.fillRect(this.x, this.y, this.width, this.height);

    }
}
